package gspringboot

import (
	"gitee.com/hongzhaomin/ginplus"
	"gitee.com/hongzhaomin/gspring/annotation"
	"gitee.com/hongzhaomin/gspring/iface"
)

// AppConfigBean 应用配置bean
type AppConfigBean struct {
	annotation.Configuration

	dataSourceRegister       annotation.Bean
	httpSession              annotation.Bean
	xormplusDaoBeanProcessor annotation.Bean
	//defaultMappingHandlerProcessor annotation.Bean

	// 这是另一种方式，更推荐用上面这种方式
	//_ [0]byte `@Bean:"HttpSession"`
}

// DataSourceRegister 注入数据源对象
func (my AppConfigBean) DataSourceRegister() *DataSourceRegister {
	return new(DataSourceRegister)
}

// HttpSession 注入session对象
func (my AppConfigBean) HttpSession(logger iface.GspringLogger) *ginplus.DefaultHttpSession {
	return ginplus.NewDefaultHttpSession(logger)
}

// XormplusDaoBeanProcessor 数据dao持久层对象增强器
func (my AppConfigBean) XormplusDaoBeanProcessor() *XormplusDaoBeanProcessor {
	return new(XormplusDaoBeanProcessor)
}

//// DefaultMappingHandlerProcessor todo 删除或替换
//func (my AppConfigBean) DefaultMappingHandlerProcessor(httpSession ginplus.HttpSession) *ginplus.DefaultMappingHandlerProcessor {
//	return ginplus.NewDefaultProcessor(httpSession)
//}
